package com.mms.pojo;

import javax.persistence.*;
import java.util.Set;

/**
 * Created by dan3652@sina.com on 2016-12-27 11:24.
 */
@Entity
@Table(name = "fan_dict")
public class FanDict {
    private int id;
    private String name;
    private String code;
    private Integer status;
    private String scort;
    private FanDict fanDict;
    private Set<FanDict> dictSet;
    private Set<FanBlog> blogSet;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "pid")
    public FanDict getFanDict() {
        return fanDict;
    }

    public void setFanDict(FanDict fanDict) {
        this.fanDict = fanDict;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "fanDict")
    public Set<FanDict> getDictSet() {
        return dictSet;
    }

    public void setDictSet(Set<FanDict> dictSet) {
        this.dictSet = dictSet;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinColumn(name = "dictId")
    public Set<FanBlog> getBlogSet() {
        return blogSet;
    }

    public void setBlogSet(Set<FanBlog> blogSet) {
        this.blogSet = blogSet;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "code")
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Basic
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Basic
    @Column(name = "scort")
    public String getScort() {
        return scort;
    }

    public void setScort(String scort) {
        this.scort = scort;
    }

    public FanDict(int id) {
        this.id = id;
    }
    public FanDict() {}

    @Override
    public String toString() {
        return "FanDict{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", code='" + code + '\'' +
                ", status=" + status +
                ", scort='" + scort + '\'' +
                "}";
    }
}
